#ifndef NesInput_H_INCLUDED
#define NesInput_H_INCLUDED

#ifdef __cplusplus
extern "C" {
#endif

#include <stdint.h>


#define NES_JOYPAD1   0x01
#define NES_JOYPAD2   0x02
#define NES_JOYPADALL 0xFF


typedef enum{
    NesInput_A      = 0x80,
    NesInput_B      = 0x40,
    NesInput_Select = 0x20,
    NesInput_Start  = 0x10,
    NesInput_Up     = 0x08,
    NesInput_Down   = 0x04,
    NesInput_Left   = 0x02,
    NesInput_Right  = 0x01,
}NesInputEnum;


typedef struct{
    uint8_t JOYPAD1;
    uint8_t JOYPAD2;

    uint8_t offset1;
    uint8_t offset2;

    int8_t enable;
}NesInputInfoType;



void vNesInputInit(void);
void vNesInputByteSet(uint8_t ucChannle, uint8_t ucValue);
uint8_t ucNesInputByteGet(uint8_t ucChannle);
void vNesInputBitSet(uint8_t ucChannle, uint8_t ucValue);
void vNesInputBitReset(uint8_t ucChannle, uint8_t ucValue);
uint8_t ucNesInputBitGet(uint8_t ucChannle);

void vNesInputReset(uint8_t ucValue);
void vNesInputExec(uint8_t ucValue);

NesInputInfoType *ptyeNesInputInfoGet(void);

#ifdef __cplusplus
}
#endif

#endif // NesInput_H_INCLUDED
